//package com.yupi.qingApiGateway;
//
//
//
//import com.yupi.springbootinit.provider.DemoService;
//import org.apache.dubbo.config.annotation.DubboReference;
//import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
//import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
//import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
//import org.springframework.context.ConfigurableApplicationContext;
//import org.springframework.stereotype.Service;
//
//@SpringBootApplication(exclude = {
//        DataSourceAutoConfiguration.class,
//        DataSourceTransactionManagerAutoConfiguration.class,
//        HibernateJpaAutoConfiguration.class})
//@EnableDubbo
//@Service
//public class QingapiGatewayApplication {
//
////    先导入一个dubbo类型的demoService来测试
//    @DubboReference
//    private DemoService demoService;
//
//
//    public static void main(String[] args) {
//        SpringApplication.run(QingapiGatewayApplication.class, args);
//        ConfigurableApplicationContext context = SpringApplication.run(QingapiGatewayApplication.class);
//        QingapiGatewayApplication application = context.getBean(QingapiGatewayApplication.class);
//        String result = application.doSayHello("qing");
//        String result2 =application.doSayHello2("qingfengzy");
//        System.out.println("result: " + result);
//        System.out.println("result: " + result2);
//
//    }
//
//
//    public String doSayHello(String name)
//    {
//        return demoService.sayHello(name);
//    }
//    public String doSayHello2(String name)
//    {
//        return demoService.sayHello2(name);
//    }
////    @Bean
////    public RouteLocator customRouteLocator(RouteLocatorBuilder builder){
////        return builder.routes()
////                .route("tobaidu",r->r.path("/baidu")
////                        .uri("http://www.baidu.com"))
////                .route("toqingicu",r->r.path("/qing")
////                        .uri("https://www.qingfengzyllnn.top"))
////                .build();
////    }
//
//}
package com.qing.springbootinit.qingApiGateway;


import com.qing.springbootinit.provider.DemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Service;

/**
 * 网关入口
 * @author qingfengzy
 */
@SpringBootApplication(exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class})
@EnableDubbo
@Service
public class QingapiGatewayApplication {

    @DubboReference
    private DemoService demoService;


    public static void main(String[] args) {

        ConfigurableApplicationContext context = SpringApplication.run(QingapiGatewayApplication.class, args);
        QingapiGatewayApplication application = context.getBean(QingapiGatewayApplication.class);
        String result = application.doSayHello("world");
        String result2 = application.doSayHello2("world");
        System.out.println("result: " + result);
        System.out.println("result: " + result2);
    }

    public String doSayHello(String name) {
        return demoService.sayHello(name);
    }

    public String doSayHello2(String name) {
        return demoService.sayHello2(name);
    }


}
